import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_widgets_pc/utils/toast_util.dart';
import 'package:flutter_widgets_pc/widgets/pullDown/pull_down_menu_simple.dart';
import 'package:flutter_widgets_pc/widgets/pullDown/entity/drop_down_option.dart';
import 'package:flutter_widgets_pc/widgets/titleBar/kq_title_bar.dart';

class KqPullDownMenuSimplePage extends StatefulWidget {
  const KqPullDownMenuSimplePage({super.key});

  @override
  State<KqPullDownMenuSimplePage> createState() =>
      _KqPullDownMenuSimplePageState();
}

class _KqPullDownMenuSimplePageState extends State<KqPullDownMenuSimplePage> {
  List<List<DropDownOption>> list = [
    [
      DropDownOption("title1", "titleId1"),
      DropDownOption("title1", "titleId2"),
      DropDownOption("title1", "titleId3"),
      DropDownOption("title1", "titleId4"),
      DropDownOption("title1", "titleId5"),
      DropDownOption("title1", "titleId6"),
      DropDownOption("title1", "titleId7"),
      DropDownOption("title1", "titleId8"),
      DropDownOption("title1", "titleId9"),
      DropDownOption("title1", "titleId10"),
      DropDownOption("title1", "titleId11")
    ],
    [
      DropDownOption("title2", "titleId1"),
      DropDownOption("title2", "titleId2"),
      DropDownOption("title2", "titleId3"),
      DropDownOption("title2", "titleId4"),
      DropDownOption("title2", "titleId5"),
      DropDownOption("title2", "titleId6"),
      DropDownOption("title2", "titleId7"),
      DropDownOption("title2", "titleId8"),
      DropDownOption("title2", "titleId9"),
      DropDownOption("title2", "titleId10"),
      DropDownOption("title2", "titleId11")
    ],
    [
      DropDownOption("title3", "titleId1"),
      DropDownOption("title3", "titleId2"),
      DropDownOption("title3", "titleId3"),
      DropDownOption("title3", "titleId4"),
      DropDownOption("title3", "titleId5"),
      DropDownOption("title3", "titleId6"),
      DropDownOption("title3", "titleId7"),
      DropDownOption("title3", "titleId8"),
      DropDownOption("title3", "titleId9"),
      DropDownOption("title3", "titleId10"),
      DropDownOption("title3", "titleId11")
    ]
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: KqHeadBar(
        headTitle: '下拉菜单演示',
        back: () {
          Get.back();
        },
      ),
      body: PullDownMenuSimple(
        listData: list,
        chosenData: [list[0][0], list[1][0], list[2][0]],
        callBack: (data, index) {
          KqToast.showNormal(data.title);
        },
      ),
    );
  }
}
